/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aal.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author quy
 */
@Entity
@Table(name = "WarehouseIO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "WarehouseIO.findAll", query = "SELECT w FROM WarehouseIO w"),
    @NamedQuery(name = "WarehouseIO.findByIoid", query = "SELECT w FROM WarehouseIO w WHERE w.ioid = :ioid"),
    @NamedQuery(name = "WarehouseIO.findByType", query = "SELECT w FROM WarehouseIO w WHERE w.type = :type"),
    @NamedQuery(name = "WarehouseIO.findByQuantity", query = "SELECT w FROM WarehouseIO w WHERE w.quantity = :quantity"),
    @NamedQuery(name = "WarehouseIO.findByDate", query = "SELECT w FROM WarehouseIO w WHERE w.date = :date")})
public class WarehouseIO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "IOID")
    private Integer ioid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Type")
    private boolean type;
    @Column(name = "Quantity")
    private Integer quantity;
    @Column(name = "Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @JoinColumn(name = "WarehouseID", referencedColumnName = "WarehouseID")
    @ManyToOne
    private Warehouse warehouseID;
    @JoinColumn(name = "ProductID", referencedColumnName = "ProductID")
    @ManyToOne
    private Product productID;
    @JoinColumn(name = "OrderID", referencedColumnName = "OrderID")
    @ManyToOne
    private OrderProduct orderID;
    @JoinColumn(name = "EmployeeID", referencedColumnName = "Username")
    @ManyToOne(optional = false)
    private Employee employeeID;

    public WarehouseIO() {
    }

    public WarehouseIO(Integer ioid) {
        this.ioid = ioid;
    }

    public WarehouseIO(Integer ioid, boolean type) {
        this.ioid = ioid;
        this.type = type;
    }

    public Integer getIoid() {
        return ioid;
    }

    public void setIoid(Integer ioid) {
        this.ioid = ioid;
    }

    public boolean getType() {
        return type;
    }

    public void setType(boolean type) {
        this.type = type;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Warehouse getWarehouseID() {
        return warehouseID;
    }

    public void setWarehouseID(Warehouse warehouseID) {
        this.warehouseID = warehouseID;
    }

    public Product getProductID() {
        return productID;
    }

    public void setProductID(Product productID) {
        this.productID = productID;
    }

    public OrderProduct getOrderID() {
        return orderID;
    }

    public void setOrderID(OrderProduct orderID) {
        this.orderID = orderID;
    }

    public Employee getEmployeeID() {
        return employeeID;
    }

    public void setEmployeeID(Employee employeeID) {
        this.employeeID = employeeID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ioid != null ? ioid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WarehouseIO)) {
            return false;
        }
        WarehouseIO other = (WarehouseIO) object;
        if ((this.ioid == null && other.ioid != null) || (this.ioid != null && !this.ioid.equals(other.ioid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aal.entity.WarehouseIO[ ioid=" + ioid + " ]";
    }
    
}
